#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>

typedef int HPDataType;

typedef struct Heap
{
	HPDataType* a;
	int size;
	int capacity;
}Heap;



void HeapInit(Heap* php);
void HeapDestory(Heap* php);

void HeapPush(Heap* php, HPDataType x);
void AdjustUp(HPDataType* pa,int pos);

void HeapPop(Heap* php);
void AdjustDown(HPDataType* pa, int pos, int n);

void HeapSort(int* a,int n);

//void Topk(int* a, int k);